PACKAGE_PATH=gitee.com/nggs/tools
WORK_DIR=$(shell pwd)
########################################################################################################################
.PHONY: all \
		make_go \
		myetcdctl \
		gen_static_data_go \
		protoc-gen-enum-go \
		protoc-gen-rpc-go \
		protoc-gen-myjson-go \
		protoc-gen-myjson-ts \
		protoc-gen-mgo-go \
		protoc-gen-pbex-go \
		protoc-gen-pbex2-go \
		trans_file_to_utf8
########################################################################################################################
all: make_go \
	myetcdctl \
	gen_static_data_go \
	protoc-gen-enum-go \
	protoc-gen-rpc-go \
	protoc-gen-myjson-go \
	protoc-gen-myjson-ts \
	protoc-gen-mgo-go \
	protoc-gen-pbex-go \
	protoc-gen-pbex2-go \
	trans_file_to_utf8
########################################################################################################################
clean:
	rm -rf $(WORK_DIR)/pkg
	rm -f $(GOPATH)/bin/make_go.sh
	rm -f $(GOPATH)/bin/myetcdctl
	rm -f $(GOPATH)/bin/gen_static_data_go
	rm -f $(GOPATH)/bin/protoc-gen-enum-go
	rm -f $(GOPATH)/bin/protoc-gen-rpc-go
	rm -f $(GOPATH)/bin/protoc-gen-myjson-go
	rm -f $(GOPATH)/bin/protoc-gen-myjson-ts
	rm -f $(GOPATH)/bin/protoc-gen-mgo-go
	rm -f $(GOPATH)/bin/protoc-gen-pbex-go
	rm -f $(GOPATH)/bin/protoc-gen-pbex2-go
########################################################################################################################
make_go:
	cp ./make_go.sh $(GOPATH)/bin
	chmod +x $(GOPATH)/bin/make_go.sh

myetcdctl:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/myetcdctl

gen_static_data_go:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/gen_static_data_go

protoc-gen-enum-go:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/protoc-gen-enum-go
	cd $(WORK_DIR)/protoc-gen-enum-go; go generate ./enum; go test

protoc-gen-rpc-go:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/protoc-gen-rpc-go
	cd $(WORK_DIR)/protoc-gen-rpc-go; go generate ./rpc; go test

protoc-gen-myjson-go:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/protoc-gen-myjson-go
	cd $(WORK_DIR)/protoc-gen-myjson-go; go generate ./msg; go test

protoc-gen-myjson-ts:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/protoc-gen-myjson-ts
	cd $(WORK_DIR)/protoc-gen-myjson-ts; go generate ./msg

protoc-gen-mgo-go:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/protoc-gen-mgo-go
	cd $(WORK_DIR)/protoc-gen-mgo-go; go generate ./model; go test

protoc-gen-pbex-go:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/protoc-gen-pbex-go
	cd $(WORK_DIR)/protoc-gen-pbex-go; go generate ./msg; go test

protoc-gen-pbex2-go:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/protoc-gen-pbex2-go
	cd $(WORK_DIR)/protoc-gen-pbex2-go; go generate ./msg; go test

trans_file_to_utf8:
	@echo $(shell date "+%F %R:%S")
	go install $(PACKAGE_PATH)/trans_file_to_utf8
########################################################################################################################
